using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework.Graphics;
using System.Collections;
using Microsoft.Xna.Framework;

namespace _395_2d
{
    public abstract class Sprite
    {
        static public SpriteBatch spriteBatch { get;  set; }

        protected string Texture;
        protected BoundingBox bounds;

        public bool intersects(Sprite s)
        {
            return bounds.overlap(s.bounds);
        }

        public bool intersects(BoundingBox b)
        {
            return bounds.overlap(b);
        }

        public void KeepInside(BoundingBox b)
        {
            bounds.keepInside(b);
        }

        //public abstract void Collide(Sprite s);

        public virtual void Draw()
        {
            Texture2D tex = (Texture2D)Content.Textures[Texture];
            Vector2 scale = new Vector2(bounds.size.X / tex.Width, bounds.size.Y / tex.Height);

            spriteBatch.Begin();
            spriteBatch.Draw(tex, bounds.topLeft, null, Color.White, 0f, new Vector2(0, 0), scale, SpriteEffects.None, 0);
            spriteBatch.End();
        }
    }
}
